package com.cxg.allsys.memsys.service.impl;

import com.cxg.allsys.memsys.mapper.FaBuMapper;
import com.cxg.allsys.memsys.pojo.Article;
import com.cxg.allsys.memsys.service.IFaBuService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
@Data
public class FaBuService implements IFaBuService {
    @Autowired
    private FaBuMapper faBuMapper;
    //查询所有内容
    @Override
    public List<Article> query() {
        log.info("service实现类query()");
        return faBuMapper.select();

    }
    //查询id
    @Override
    public Article queryid(Integer id) {
        log.info("service实现类query()");
        Article a=faBuMapper.selectid(id);
        log.info(String.valueOf(a));
        return a;
    }
    //插入
    @Override
    public boolean insert(Article article) {
        log.info("service实现类insert");
        boolean falg = faBuMapper.insert(article);
        if(falg){
            return true;
        }else{
            return false;
        }
    }
    //更新
    @Override
    public boolean update(Article article) {
        log.info("service实现类update");
        boolean falg = faBuMapper.update(article);
        if(falg){
            return true;
        }else{
            return false;
        }
    }
    //删除
    @Override
    public boolean delete(Integer id) {
        log.info("service实现类delete");
        boolean falg = faBuMapper.delete(id);
        if(falg){
            return true;
        }else{
            return false;
        }
    }
}
